﻿using System;
using System.Collections.Generic;

#region MIT License text
/*
Copyright (c) 2009 Mark van Straten - Q42 B.V.

Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
*/
#endregion

namespace Q42.Wheels.Api.Nabaztag
{
    /// <summary>
    /// Class that defines this action that the nabaztag can do
    /// </summary>
    /// <remarks>This class acts like a wrapper pattern; it embeds the previous action so all can be played</remarks>
    public class TextToSpeechAction : NabaztagAction
    {
        /// <summary>
        /// message this action will play
        /// </summary>
        private string message;
        /// <summary>
        /// Message of this action
        /// </summary>
        public string Message { 
            get { 
                return this.message;
            }
            protected set { 
                this.message = value; 
            }
        }

        /// <summary>
        /// Choicen voice for this message
        /// </summary>
        private string voice;
        /// <summary>
        /// Choicen voice for this message
        /// </summary>
        public string Voice { 
            get { 
                return this.voice; 
            } 
            protected set { 
                this.voice = value; 
            } 
        }

        /// <summary>
        /// Send an text to speech message to the Nabaztag
        /// </summary>
        /// <param name="message"></param>
        /// <param name="voice">defaults to UK-Penelope</param>
        public TextToSpeechAction(string message, string voice)
        {
            if (message.Equals(string.Empty))
                throw new ArgumentOutOfRangeException("No empty message allowed");
            Message = message;

            if(voice.Equals(string.Empty))
                Voice = "UK-Penelope";
            else
                Voice = voice;
        }

        /// <summary>
        /// Return all parameters for this action in the given parameters dictionary
        /// </summary>
        /// <param name="parameters"></param>
        public override void ToStringList(ref Dictionary<String, String> parameters)
        {
            parameters.Add("voice", Voice);
            parameters.Add("tts", Message);
        }
    }
}
